

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>argoverse.visualization.visualization_utils &mdash; argoverse  documentation</title>
  

  
  
  
  

  
  <script type="text/javascript" src="../../../_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script type="text/javascript" src="../../../_static/jquery.js"></script>
        <script type="text/javascript" src="../../../_static/underscore.js"></script>
        <script type="text/javascript" src="../../../_static/doctools.js"></script>
        <script type="text/javascript" src="../../../_static/language_data.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
    <link rel="index" title="Index" href="../../../genindex.html" />
    <link rel="search" title="Search" href="../../../search.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="../../../index.html" class="icon icon-home"> argoverse
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <!-- Local TOC -->
              <div class="local-toc"></div>
            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../index.html">argoverse</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../index.html">Docs</a> &raquo;</li>
        
          <li><a href="../../index.html">Module code</a> &raquo;</li>
        
      <li>argoverse.visualization.visualization_utils</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <h1>Source code for argoverse.visualization.visualization_utils</h1><div class="highlight"><pre>
<span></span><span class="c1"># &lt;Copyright 2019, Argo AI, LLC. Released under the MIT license.&gt;</span>

<span class="kn">import</span> <span class="nn">copy</span>
<span class="kn">import</span> <span class="nn">logging</span>
<span class="kn">from</span> <span class="nn">collections</span> <span class="k">import</span> <span class="n">defaultdict</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="k">import</span> <span class="n">Any</span><span class="p">,</span> <span class="n">Dict</span><span class="p">,</span> <span class="n">Iterable</span><span class="p">,</span> <span class="n">List</span><span class="p">,</span> <span class="n">Optional</span><span class="p">,</span> <span class="n">Tuple</span><span class="p">,</span> <span class="n">Union</span>

<span class="kn">import</span> <span class="nn">cv2</span>
<span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">from</span> <span class="nn">argoverse.data_loading.argoverse_tracking_loader</span> <span class="k">import</span> <span class="n">ArgoverseTrackingLoader</span>
<span class="kn">from</span> <span class="nn">argoverse.data_loading.object_classes</span> <span class="k">import</span> <span class="n">OBJ_CLASS_MAPPING_DICT</span>
<span class="kn">from</span> <span class="nn">argoverse.data_loading.object_label_record</span> <span class="k">import</span> <span class="n">ObjectLabelRecord</span>
<span class="kn">from</span> <span class="nn">argoverse.utils.calibration</span> <span class="k">import</span> <span class="n">Calibration</span><span class="p">,</span> <span class="n">determine_valid_cam_coords</span><span class="p">,</span> <span class="n">proj_cam_to_uv</span>
<span class="kn">from</span> <span class="nn">argoverse.utils.frustum_clipping</span> <span class="k">import</span> <span class="n">generate_frustum_planes</span>
<span class="kn">from</span> <span class="nn">PIL</span> <span class="k">import</span> <span class="n">Image</span>

<span class="n">point_size</span> <span class="o">=</span> <span class="mf">0.01</span>
<span class="n">axes_limits</span> <span class="o">=</span> <span class="p">[[</span><span class="o">-</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">],</span> <span class="p">[</span><span class="o">-</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">],</span> <span class="p">[</span><span class="o">-</span><span class="mi">3</span><span class="p">,</span> <span class="mi">10</span><span class="p">]]</span>  <span class="c1"># X axis range  # Y axis range  # Z axis range</span>
<span class="n">axes_str</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;X&quot;</span><span class="p">,</span> <span class="s2">&quot;Y&quot;</span><span class="p">,</span> <span class="s2">&quot;Z&quot;</span><span class="p">]</span>

<span class="n">_COLOR_MAP</span> <span class="o">=</span> <span class="p">[</span>
    <span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">rand</span><span class="p">()),</span> <span class="nb">float</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">rand</span><span class="p">()),</span> <span class="nb">float</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">rand</span><span class="p">()))</span>
    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">OBJ_CLASS_MAPPING_DICT</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span>
<span class="p">]</span>


<span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="vm">__name__</span><span class="p">)</span>


<span class="k">def</span> <span class="nf">_get_axes_or_default</span><span class="p">(</span><span class="n">axes</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Any</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="n">Any</span><span class="p">:</span>
    <span class="k">if</span> <span class="n">axes</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
        <span class="k">return</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">]</span>
    <span class="k">else</span><span class="p">:</span>
        <span class="k">return</span> <span class="n">axes</span>


<div class="viewcode-block" id="draw_point_cloud"><a class="viewcode-back" href="../../../argoverse.visualization.html#argoverse.visualization.visualization_utils.draw_point_cloud">[docs]</a><span class="k">def</span> <span class="nf">draw_point_cloud</span><span class="p">(</span>
    <span class="n">ax</span><span class="p">:</span> <span class="n">plt</span><span class="o">.</span><span class="n">Axes</span><span class="p">,</span>
    <span class="n">title</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span>
    <span class="n">argoverse_data</span><span class="p">:</span> <span class="n">ArgoverseTrackingLoader</span><span class="p">,</span>
    <span class="n">idx</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span>
    <span class="n">axes</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
    <span class="n">xlim3d</span><span class="p">:</span> <span class="n">Any</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
    <span class="n">ylim3d</span><span class="p">:</span> <span class="n">Any</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
    <span class="n">zlim3d</span><span class="p">:</span> <span class="n">Any</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
    <span class="n">axes</span> <span class="o">=</span> <span class="n">_get_axes_or_default</span><span class="p">(</span><span class="n">axes</span><span class="p">)</span>
    <span class="n">pc</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_lidar</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span>
    <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">pc</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">)</span>
    <span class="n">objects</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_label_object</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span>
    <span class="n">ax</span><span class="o">.</span><span class="n">scatter</span><span class="p">(</span><span class="o">*</span><span class="n">np</span><span class="o">.</span><span class="n">transpose</span><span class="p">(</span><span class="n">pc</span><span class="p">[:,</span> <span class="n">axes</span><span class="p">]),</span> <span class="n">s</span><span class="o">=</span><span class="n">point_size</span><span class="p">,</span> <span class="n">c</span><span class="o">=</span><span class="n">pc</span><span class="p">[:,</span> <span class="mi">2</span><span class="p">],</span> <span class="n">cmap</span><span class="o">=</span><span class="s2">&quot;gray&quot;</span><span class="p">)</span>
    <span class="n">ax</span><span class="o">.</span><span class="n">set_title</span><span class="p">(</span><span class="n">title</span><span class="p">)</span>
    <span class="n">ax</span><span class="o">.</span><span class="n">set_xlabel</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">{}</span><span class="s2"> axis&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">axes_str</span><span class="p">[</span><span class="n">axes</span><span class="p">[</span><span class="mi">0</span><span class="p">]]))</span>
    <span class="n">ax</span><span class="o">.</span><span class="n">set_ylabel</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">{}</span><span class="s2"> axis&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">axes_str</span><span class="p">[</span><span class="n">axes</span><span class="p">[</span><span class="mi">1</span><span class="p">]]))</span>
    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">axes</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">2</span><span class="p">:</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_xlim3d</span><span class="p">(</span><span class="o">*</span><span class="n">axes_limits</span><span class="p">[</span><span class="n">axes</span><span class="p">[</span><span class="mi">0</span><span class="p">]])</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_ylim3d</span><span class="p">(</span><span class="o">*</span><span class="n">axes_limits</span><span class="p">[</span><span class="n">axes</span><span class="p">[</span><span class="mi">1</span><span class="p">]])</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_zlim3d</span><span class="p">(</span><span class="o">*</span><span class="n">axes_limits</span><span class="p">[</span><span class="n">axes</span><span class="p">[</span><span class="mi">2</span><span class="p">]])</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_zlabel</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">{}</span><span class="s2"> axis&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">axes_str</span><span class="p">[</span><span class="n">axes</span><span class="p">[</span><span class="mi">2</span><span class="p">]]))</span>
    <span class="k">else</span><span class="p">:</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_xlim</span><span class="p">(</span><span class="o">*</span><span class="n">axes_limits</span><span class="p">[</span><span class="n">axes</span><span class="p">[</span><span class="mi">0</span><span class="p">]])</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_ylim</span><span class="p">(</span><span class="o">*</span><span class="n">axes_limits</span><span class="p">[</span><span class="n">axes</span><span class="p">[</span><span class="mi">1</span><span class="p">]])</span>
        <span class="c1"># User specified limits</span>
    <span class="k">if</span> <span class="n">xlim3d</span> <span class="o">!=</span> <span class="kc">None</span><span class="p">:</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_xlim3d</span><span class="p">(</span><span class="n">xlim3d</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">ylim3d</span> <span class="o">!=</span> <span class="kc">None</span><span class="p">:</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_ylim3d</span><span class="p">(</span><span class="n">ylim3d</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">zlim3d</span> <span class="o">!=</span> <span class="kc">None</span><span class="p">:</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_zlim3d</span><span class="p">(</span><span class="n">zlim3d</span><span class="p">)</span>

    <span class="k">for</span> <span class="n">obj</span> <span class="ow">in</span> <span class="n">objects</span><span class="p">:</span>
        <span class="k">if</span> <span class="n">obj</span><span class="o">.</span><span class="n">occlusion</span> <span class="o">==</span> <span class="mi">100</span><span class="p">:</span>
            <span class="k">continue</span>

        <span class="k">if</span> <span class="n">obj</span><span class="o">.</span><span class="n">label_class</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s2">&quot;No label class, just picking the default color.&quot;</span><span class="p">)</span>
            <span class="n">color</span> <span class="o">=</span> <span class="n">_COLOR_MAP</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">color</span> <span class="o">=</span> <span class="n">_COLOR_MAP</span><span class="p">[</span><span class="n">OBJ_CLASS_MAPPING_DICT</span><span class="p">[</span><span class="n">obj</span><span class="o">.</span><span class="n">label_class</span><span class="p">]]</span>

        <span class="n">draw_box</span><span class="p">(</span><span class="n">ax</span><span class="p">,</span> <span class="n">obj</span><span class="o">.</span><span class="n">as_3d_bbox</span><span class="p">()</span><span class="o">.</span><span class="n">T</span><span class="p">,</span> <span class="n">axes</span><span class="o">=</span><span class="n">axes</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">)</span></div>


<div class="viewcode-block" id="draw_point_cloud_trajectory"><a class="viewcode-back" href="../../../argoverse.visualization.html#argoverse.visualization.visualization_utils.draw_point_cloud_trajectory">[docs]</a><span class="k">def</span> <span class="nf">draw_point_cloud_trajectory</span><span class="p">(</span>
    <span class="n">ax</span><span class="p">:</span> <span class="n">plt</span><span class="o">.</span><span class="n">Axes</span><span class="p">,</span>
    <span class="n">title</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span>
    <span class="n">argoverse_data</span><span class="p">:</span> <span class="n">ArgoverseTrackingLoader</span><span class="p">,</span>
    <span class="n">idx</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span>
    <span class="n">axes</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
    <span class="n">xlim3d</span><span class="p">:</span> <span class="n">Any</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
    <span class="n">ylim3d</span><span class="p">:</span> <span class="n">Any</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
    <span class="n">zlim3d</span><span class="p">:</span> <span class="n">Any</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
    <span class="n">axes</span> <span class="o">=</span> <span class="n">_get_axes_or_default</span><span class="p">(</span><span class="n">axes</span><span class="p">)</span>
    <span class="n">unique_id_list</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span>
    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">argoverse_data</span><span class="o">.</span><span class="n">label_list</span><span class="p">)):</span>
        <span class="k">for</span> <span class="n">label</span> <span class="ow">in</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_label_object</span><span class="p">(</span><span class="n">i</span><span class="p">):</span>
            <span class="n">unique_id_list</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">label</span><span class="o">.</span><span class="n">track_id</span><span class="p">)</span>
    <span class="n">color_map</span> <span class="o">=</span> <span class="p">{</span>
        <span class="n">track_id</span><span class="p">:</span> <span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">rand</span><span class="p">()),</span> <span class="nb">float</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">rand</span><span class="p">()),</span> <span class="nb">float</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">rand</span><span class="p">()))</span>
        <span class="k">for</span> <span class="n">track_id</span> <span class="ow">in</span> <span class="n">unique_id_list</span>
    <span class="p">}</span>
    <span class="n">pc</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_lidar</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span>
    <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">pc</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">)</span>
    <span class="n">objects</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_label_object</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span>
    <span class="n">ax</span><span class="o">.</span><span class="n">scatter</span><span class="p">(</span><span class="o">*</span><span class="n">np</span><span class="o">.</span><span class="n">transpose</span><span class="p">(</span><span class="n">pc</span><span class="p">[:,</span> <span class="n">axes</span><span class="p">]),</span> <span class="n">s</span><span class="o">=</span><span class="n">point_size</span><span class="p">,</span> <span class="n">c</span><span class="o">=</span><span class="n">pc</span><span class="p">[:,</span> <span class="mi">2</span><span class="p">],</span> <span class="n">cmap</span><span class="o">=</span><span class="s2">&quot;gray&quot;</span><span class="p">)</span>
    <span class="n">ax</span><span class="o">.</span><span class="n">set_title</span><span class="p">(</span><span class="n">title</span><span class="p">)</span>
    <span class="n">ax</span><span class="o">.</span><span class="n">set_xlabel</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">{}</span><span class="s2"> axis&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">axes_str</span><span class="p">[</span><span class="n">axes</span><span class="p">[</span><span class="mi">0</span><span class="p">]]))</span>
    <span class="n">ax</span><span class="o">.</span><span class="n">set_ylabel</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">{}</span><span class="s2"> axis&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">axes_str</span><span class="p">[</span><span class="n">axes</span><span class="p">[</span><span class="mi">1</span><span class="p">]]))</span>
    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">axes</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">2</span><span class="p">:</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_xlim3d</span><span class="p">(</span><span class="o">*</span><span class="n">axes_limits</span><span class="p">[</span><span class="n">axes</span><span class="p">[</span><span class="mi">0</span><span class="p">]])</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_ylim3d</span><span class="p">(</span><span class="o">*</span><span class="n">axes_limits</span><span class="p">[</span><span class="n">axes</span><span class="p">[</span><span class="mi">1</span><span class="p">]])</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_zlim3d</span><span class="p">(</span><span class="o">*</span><span class="n">axes_limits</span><span class="p">[</span><span class="n">axes</span><span class="p">[</span><span class="mi">2</span><span class="p">]])</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_zlabel</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">{}</span><span class="s2"> axis&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">axes_str</span><span class="p">[</span><span class="n">axes</span><span class="p">[</span><span class="mi">2</span><span class="p">]]))</span>
    <span class="k">else</span><span class="p">:</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_xlim</span><span class="p">(</span><span class="o">*</span><span class="n">axes_limits</span><span class="p">[</span><span class="n">axes</span><span class="p">[</span><span class="mi">0</span><span class="p">]])</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_ylim</span><span class="p">(</span><span class="o">*</span><span class="n">axes_limits</span><span class="p">[</span><span class="n">axes</span><span class="p">[</span><span class="mi">1</span><span class="p">]])</span>
        <span class="c1"># User specified limits</span>
    <span class="k">if</span> <span class="n">xlim3d</span> <span class="o">!=</span> <span class="kc">None</span><span class="p">:</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_xlim3d</span><span class="p">(</span><span class="n">xlim3d</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">ylim3d</span> <span class="o">!=</span> <span class="kc">None</span><span class="p">:</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_ylim3d</span><span class="p">(</span><span class="n">ylim3d</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">zlim3d</span> <span class="o">!=</span> <span class="kc">None</span><span class="p">:</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_zlim3d</span><span class="p">(</span><span class="n">zlim3d</span><span class="p">)</span>
    <span class="n">visible_track_id</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span>
    <span class="k">for</span> <span class="n">obj</span> <span class="ow">in</span> <span class="n">objects</span><span class="p">:</span>
        <span class="k">if</span> <span class="n">obj</span><span class="o">.</span><span class="n">occlusion</span> <span class="o">==</span> <span class="mi">100</span><span class="p">:</span>
            <span class="k">continue</span>
        <span class="n">draw_box</span><span class="p">(</span><span class="n">ax</span><span class="p">,</span> <span class="n">obj</span><span class="o">.</span><span class="n">as_3d_bbox</span><span class="p">()</span><span class="o">.</span><span class="n">T</span><span class="p">,</span> <span class="n">axes</span><span class="o">=</span><span class="n">axes</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="n">color_map</span><span class="p">[</span><span class="n">obj</span><span class="o">.</span><span class="n">track_id</span><span class="p">])</span>

        <span class="n">visible_track_id</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">obj</span><span class="o">.</span><span class="n">track_id</span><span class="p">)</span>

    <span class="n">current_pose</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_pose</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span>
    <span class="n">traj_by_id</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">List</span><span class="p">[</span><span class="n">Any</span><span class="p">]]</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="nb">list</span><span class="p">)</span>
    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">idx</span><span class="p">,</span> <span class="mi">1</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">current_pose</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s2">&quot;`current_pose` is missing at index </span><span class="si">%d</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">idx</span><span class="p">)</span>
            <span class="k">break</span>

        <span class="n">pose</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_pose</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">pose</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s2">&quot;`pose` is missing at index </span><span class="si">%d</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">i</span><span class="p">)</span>
            <span class="k">continue</span>

        <span class="n">objects</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_label_object</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>

        <span class="k">for</span> <span class="n">obj</span> <span class="ow">in</span> <span class="n">objects</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">obj</span><span class="o">.</span><span class="n">occlusion</span> <span class="o">==</span> <span class="mi">100</span><span class="p">:</span>
                <span class="k">continue</span>
            <span class="k">if</span> <span class="n">obj</span><span class="o">.</span><span class="n">track_id</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">obj</span><span class="o">.</span><span class="n">track_id</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">visible_track_id</span><span class="p">:</span>
                <span class="k">continue</span>
            <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span> <span class="o">=</span> <span class="n">pose</span><span class="o">.</span><span class="n">transform_point_cloud</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">obj</span><span class="o">.</span><span class="n">translation</span><span class="p">)]))[</span><span class="mi">0</span><span class="p">]</span>

            <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">current_pose</span><span class="o">.</span><span class="n">inverse_transform_point_cloud</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">])]))[</span><span class="mi">0</span><span class="p">]</span>

            <span class="c1"># ax.scatter(x,y, s=point_size, c=color_map[obj.track_id])</span>
            <span class="k">if</span> <span class="n">obj</span><span class="o">.</span><span class="n">track_id</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
                <span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s2">&quot;Label has no track_id.  Collisions with other tracks that are missing IDs could happen&quot;</span><span class="p">)</span>

            <span class="n">traj_by_id</span><span class="p">[</span><span class="n">obj</span><span class="o">.</span><span class="n">track_id</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">])</span>

    <span class="k">for</span> <span class="n">track_id</span> <span class="ow">in</span> <span class="n">traj_by_id</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
        <span class="n">traj</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">traj_by_id</span><span class="p">[</span><span class="n">track_id</span><span class="p">])</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">traj</span><span class="p">[:,</span> <span class="mi">0</span><span class="p">],</span> <span class="n">traj</span><span class="p">[:,</span> <span class="mi">1</span><span class="p">],</span> <span class="n">color</span><span class="o">=</span><span class="n">color_map</span><span class="p">[</span><span class="n">track_id</span><span class="p">],</span> <span class="n">linestyle</span><span class="o">=</span><span class="s2">&quot;--&quot;</span><span class="p">,</span> <span class="n">linewidth</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span></div>


<div class="viewcode-block" id="draw_box"><a class="viewcode-back" href="../../../argoverse.visualization.html#argoverse.visualization.visualization_utils.draw_box">[docs]</a><span class="k">def</span> <span class="nf">draw_box</span><span class="p">(</span>
    <span class="n">pyplot_axis</span><span class="p">:</span> <span class="n">plt</span><span class="o">.</span><span class="n">Axes</span><span class="p">,</span>
    <span class="n">vertices</span><span class="p">:</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">,</span>
    <span class="n">axes</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
    <span class="n">color</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Tuple</span><span class="p">[</span><span class="nb">float</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">float</span><span class="p">]]</span> <span class="o">=</span> <span class="s2">&quot;red&quot;</span><span class="p">,</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
    <span class="n">axes</span> <span class="o">=</span> <span class="n">_get_axes_or_default</span><span class="p">(</span><span class="n">axes</span><span class="p">)</span>
    <span class="n">vertices</span> <span class="o">=</span> <span class="n">vertices</span><span class="p">[</span><span class="n">axes</span><span class="p">,</span> <span class="p">:]</span>
    <span class="n">connections</span> <span class="o">=</span> <span class="p">[</span>
        <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span>
        <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span>
        <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span>
        <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span>  <span class="c1"># Lower plane parallel to Z=0 plane</span>
        <span class="p">[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">],</span>
        <span class="p">[</span><span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">],</span>
        <span class="p">[</span><span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">],</span>
        <span class="p">[</span><span class="mi">7</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</span>  <span class="c1"># Upper plane parallel to Z=0 plane</span>
        <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</span>
        <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">],</span>
        <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">6</span><span class="p">],</span>
        <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">7</span><span class="p">],</span>  <span class="c1"># Connections between upper and lower planes</span>
    <span class="p">]</span>
    <span class="k">for</span> <span class="n">connection</span> <span class="ow">in</span> <span class="n">connections</span><span class="p">:</span>
        <span class="n">pyplot_axis</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="o">*</span><span class="n">vertices</span><span class="p">[:,</span> <span class="n">connection</span><span class="p">],</span> <span class="n">c</span><span class="o">=</span><span class="n">color</span><span class="p">,</span> <span class="n">lw</span><span class="o">=</span><span class="mf">0.5</span><span class="p">)</span></div>


<div class="viewcode-block" id="show_image_with_boxes"><a class="viewcode-back" href="../../../argoverse.visualization.html#argoverse.visualization.visualization_utils.show_image_with_boxes">[docs]</a><span class="k">def</span> <span class="nf">show_image_with_boxes</span><span class="p">(</span><span class="n">img</span><span class="p">:</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">,</span> <span class="n">objects</span><span class="p">:</span> <span class="n">Iterable</span><span class="p">[</span><span class="n">ObjectLabelRecord</span><span class="p">],</span> <span class="n">calib</span><span class="p">:</span> <span class="n">Calibration</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">:</span>
    <span class="sd">&quot;&quot;&quot; Show image with 2D bounding boxes &quot;&quot;&quot;</span>
    <span class="n">img1</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
    <span class="n">K</span> <span class="o">=</span> <span class="n">calib</span><span class="o">.</span><span class="n">K</span>
    <span class="n">d</span> <span class="o">=</span> <span class="n">calib</span><span class="o">.</span><span class="n">d</span>

    <span class="n">h</span><span class="p">,</span> <span class="n">w</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">shape</span><span class="p">(</span><span class="n">img1</span><span class="p">)[</span><span class="mi">0</span><span class="p">:</span><span class="mi">2</span><span class="p">]</span>
    <span class="n">planes</span> <span class="o">=</span> <span class="n">generate_frustum_planes</span><span class="p">(</span><span class="n">calib</span><span class="o">.</span><span class="n">K</span><span class="p">,</span> <span class="n">calib</span><span class="o">.</span><span class="n">camera</span><span class="p">)</span>
    <span class="k">assert</span> <span class="n">planes</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span>

    <span class="k">for</span> <span class="n">obj</span> <span class="ow">in</span> <span class="n">objects</span><span class="p">:</span>
        <span class="k">if</span> <span class="n">obj</span><span class="o">.</span><span class="n">occlusion</span> <span class="o">==</span> <span class="mi">100</span><span class="p">:</span>
            <span class="k">continue</span>
        <span class="n">box3d_pts_3d</span> <span class="o">=</span> <span class="n">obj</span><span class="o">.</span><span class="n">as_3d_bbox</span><span class="p">()</span>
        <span class="n">uv</span> <span class="o">=</span> <span class="n">calib</span><span class="o">.</span><span class="n">project_ego_to_image</span><span class="p">(</span><span class="n">box3d_pts_3d</span><span class="p">)</span>
        <span class="n">uv_cam</span> <span class="o">=</span> <span class="n">calib</span><span class="o">.</span><span class="n">project_ego_to_cam</span><span class="p">(</span><span class="n">box3d_pts_3d</span><span class="p">)</span>

        <span class="n">img1</span> <span class="o">=</span> <span class="n">obj</span><span class="o">.</span><span class="n">render_clip_frustum_cv2</span><span class="p">(</span>
            <span class="n">img1</span><span class="p">,</span> <span class="n">uv_cam</span><span class="p">[:,</span> <span class="p">:</span><span class="mi">3</span><span class="p">],</span> <span class="n">planes</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">calib</span><span class="o">.</span><span class="n">camera_config</span><span class="p">),</span> <span class="n">linewidth</span><span class="o">=</span><span class="mi">3</span>
        <span class="p">)</span>

    <span class="k">return</span> <span class="n">img1</span></div>


<div class="viewcode-block" id="make_grid_ring_camera"><a class="viewcode-back" href="../../../argoverse.visualization.html#argoverse.visualization.visualization_utils.make_grid_ring_camera">[docs]</a><span class="k">def</span> <span class="nf">make_grid_ring_camera</span><span class="p">(</span><span class="n">argoverse_data</span><span class="p">:</span> <span class="n">ArgoverseTrackingLoader</span><span class="p">,</span> <span class="n">idx</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Tuple</span><span class="p">[</span><span class="n">plt</span><span class="o">.</span><span class="n">Figure</span><span class="p">,</span> <span class="n">plt</span><span class="o">.</span><span class="n">Axes</span><span class="p">]:</span>

    <span class="n">f</span><span class="p">,</span> <span class="n">ax</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplots</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">15</span><span class="p">))</span>

    <span class="n">camera</span> <span class="o">=</span> <span class="s2">&quot;ring_front_left&quot;</span>
    <span class="n">img</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_image_sync</span><span class="p">(</span><span class="n">idx</span><span class="p">,</span> <span class="n">camera</span><span class="o">=</span><span class="n">camera</span><span class="p">)</span>
    <span class="n">objects</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_label_object</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span>
    <span class="n">calib</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_calibration</span><span class="p">(</span><span class="n">camera</span><span class="p">)</span>
    <span class="n">img_vis</span> <span class="o">=</span> <span class="n">Image</span><span class="o">.</span><span class="n">fromarray</span><span class="p">(</span><span class="n">show_image_with_boxes</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="n">objects</span><span class="p">,</span> <span class="n">calib</span><span class="p">))</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">imshow</span><span class="p">(</span><span class="n">img_vis</span><span class="p">)</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">set_title</span><span class="p">(</span><span class="s2">&quot;Ring Front Left&quot;</span><span class="p">)</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">axis</span><span class="p">(</span><span class="s2">&quot;off&quot;</span><span class="p">)</span>

    <span class="n">camera</span> <span class="o">=</span> <span class="s2">&quot;ring_front_center&quot;</span>
    <span class="n">img</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_image_sync</span><span class="p">(</span><span class="n">idx</span><span class="p">,</span> <span class="n">camera</span><span class="o">=</span><span class="n">camera</span><span class="p">)</span>
    <span class="n">objects</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_label_object</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span>
    <span class="n">calib</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_calibration</span><span class="p">(</span><span class="n">camera</span><span class="p">)</span>
    <span class="n">img_vis</span> <span class="o">=</span> <span class="n">Image</span><span class="o">.</span><span class="n">fromarray</span><span class="p">(</span><span class="n">show_image_with_boxes</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="n">objects</span><span class="p">,</span> <span class="n">calib</span><span class="p">))</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">imshow</span><span class="p">(</span><span class="n">img_vis</span><span class="p">)</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">set_title</span><span class="p">(</span><span class="s2">&quot;Right Front Center&quot;</span><span class="p">)</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">axis</span><span class="p">(</span><span class="s2">&quot;off&quot;</span><span class="p">)</span>

    <span class="n">camera</span> <span class="o">=</span> <span class="s2">&quot;ring_front_right&quot;</span>
    <span class="n">img</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_image_sync</span><span class="p">(</span><span class="n">idx</span><span class="p">,</span> <span class="n">camera</span><span class="o">=</span><span class="n">camera</span><span class="p">)</span>
    <span class="n">objects</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_label_object</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span>
    <span class="n">calib</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_calibration</span><span class="p">(</span><span class="n">camera</span><span class="p">)</span>
    <span class="n">img_vis</span> <span class="o">=</span> <span class="n">Image</span><span class="o">.</span><span class="n">fromarray</span><span class="p">(</span><span class="n">show_image_with_boxes</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="n">objects</span><span class="p">,</span> <span class="n">calib</span><span class="p">))</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">imshow</span><span class="p">(</span><span class="n">img_vis</span><span class="p">)</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">set_title</span><span class="p">(</span><span class="s2">&quot;Ring Front Right&quot;</span><span class="p">)</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">axis</span><span class="p">(</span><span class="s2">&quot;off&quot;</span><span class="p">)</span>

    <span class="n">camera</span> <span class="o">=</span> <span class="s2">&quot;ring_side_left&quot;</span>
    <span class="n">img</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_image_sync</span><span class="p">(</span><span class="n">idx</span><span class="p">,</span> <span class="n">camera</span><span class="o">=</span><span class="n">camera</span><span class="p">)</span>
    <span class="n">objects</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_label_object</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span>
    <span class="n">calib</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_calibration</span><span class="p">(</span><span class="n">camera</span><span class="p">)</span>
    <span class="n">img_vis</span> <span class="o">=</span> <span class="n">Image</span><span class="o">.</span><span class="n">fromarray</span><span class="p">(</span><span class="n">show_image_with_boxes</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="n">objects</span><span class="p">,</span> <span class="n">calib</span><span class="p">))</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">imshow</span><span class="p">(</span><span class="n">img_vis</span><span class="p">)</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">set_title</span><span class="p">(</span><span class="s2">&quot;Ring Side Left&quot;</span><span class="p">)</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">axis</span><span class="p">(</span><span class="s2">&quot;off&quot;</span><span class="p">)</span>

    <span class="n">ax</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">axis</span><span class="p">(</span><span class="s2">&quot;off&quot;</span><span class="p">)</span>

    <span class="n">camera</span> <span class="o">=</span> <span class="s2">&quot;ring_side_right&quot;</span>
    <span class="n">img</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_image_sync</span><span class="p">(</span><span class="n">idx</span><span class="p">,</span> <span class="n">camera</span><span class="o">=</span><span class="n">camera</span><span class="p">)</span>
    <span class="n">objects</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_label_object</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span>
    <span class="n">calib</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_calibration</span><span class="p">(</span><span class="n">camera</span><span class="p">)</span>
    <span class="n">img_vis</span> <span class="o">=</span> <span class="n">Image</span><span class="o">.</span><span class="n">fromarray</span><span class="p">(</span><span class="n">show_image_with_boxes</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="n">objects</span><span class="p">,</span> <span class="n">calib</span><span class="p">))</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">imshow</span><span class="p">(</span><span class="n">img_vis</span><span class="p">)</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">set_title</span><span class="p">(</span><span class="s2">&quot;Ring Side Right&quot;</span><span class="p">)</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">axis</span><span class="p">(</span><span class="s2">&quot;off&quot;</span><span class="p">)</span>

    <span class="n">camera</span> <span class="o">=</span> <span class="s2">&quot;ring_rear_left&quot;</span>
    <span class="n">img</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_image_sync</span><span class="p">(</span><span class="n">idx</span><span class="p">,</span> <span class="n">camera</span><span class="o">=</span><span class="n">camera</span><span class="p">)</span>
    <span class="n">objects</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_label_object</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span>
    <span class="n">calib</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_calibration</span><span class="p">(</span><span class="n">camera</span><span class="p">)</span>
    <span class="n">img_vis</span> <span class="o">=</span> <span class="n">Image</span><span class="o">.</span><span class="n">fromarray</span><span class="p">(</span><span class="n">show_image_with_boxes</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="n">objects</span><span class="p">,</span> <span class="n">calib</span><span class="p">))</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">imshow</span><span class="p">(</span><span class="n">img_vis</span><span class="p">)</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">set_title</span><span class="p">(</span><span class="s2">&quot;Ring Rear Left&quot;</span><span class="p">)</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">axis</span><span class="p">(</span><span class="s2">&quot;off&quot;</span><span class="p">)</span>

    <span class="n">ax</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">axis</span><span class="p">(</span><span class="s2">&quot;off&quot;</span><span class="p">)</span>

    <span class="n">camera</span> <span class="o">=</span> <span class="s2">&quot;ring_rear_right&quot;</span>
    <span class="n">img</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_image_sync</span><span class="p">(</span><span class="n">idx</span><span class="p">,</span> <span class="n">camera</span><span class="o">=</span><span class="n">camera</span><span class="p">)</span>
    <span class="n">objects</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_label_object</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span>
    <span class="n">calib</span> <span class="o">=</span> <span class="n">argoverse_data</span><span class="o">.</span><span class="n">get_calibration</span><span class="p">(</span><span class="n">camera</span><span class="p">)</span>
    <span class="n">img_vis</span> <span class="o">=</span> <span class="n">Image</span><span class="o">.</span><span class="n">fromarray</span><span class="p">(</span><span class="n">show_image_with_boxes</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="n">objects</span><span class="p">,</span> <span class="n">calib</span><span class="p">))</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">imshow</span><span class="p">(</span><span class="n">img_vis</span><span class="p">)</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">set_title</span><span class="p">(</span><span class="s2">&quot;Ring Rear Right&quot;</span><span class="p">)</span>
    <span class="n">ax</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">axis</span><span class="p">(</span><span class="s2">&quot;off&quot;</span><span class="p">)</span>

    <span class="k">return</span> <span class="n">f</span><span class="p">,</span> <span class="n">ax</span></div>
</pre></div>

           </div>
           
          </div>
          <footer>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2019, Argo AI, LLC

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>